package com.example.demo.service;

import com.example.demo.entity.Goods;
import com.example.demo.mapper.GoodsMapper;
import com.example.demo.utils.CommonUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.Date;
import java.util.List;

@Service
public class GoodService {
    @Autowired
    GoodsMapper goodsMapper;

    // 单表的增删改都可以直接用封装好的
    public List<Goods> getAllGoods(){
        return goodsMapper.selectAll();
    }

    public int addGoods(Goods goods){
        goods.setProductTime(new Date());// 时间的使用
        return goodsMapper.insertSelective(goods);
    }




}
